#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_system.h"
// #include "driver/spi_master.h"
// #include "driver/gpio.h"

#include "ugui.h"

#include "spi.h"

#define TAG "function_ptr_test"

UG_GUI mGUI;
UG_WINDOW mWINDOW;

void app_main(void)
{
    spi_Init();
    LCD_Init();
    // LCD_Fill(0,0,50,50,245);

    UG_Init(&mGUI, LCD_DrawPoint, 128, 160);

    UG_DriverRegister(DRIVER_DRAW_LINE, LCD_DrawLine);
    UG_DriverEnable(DRIVER_DRAW_LINE);

    UG_DriverRegister(DRIVER_FILL_FRAME, LCD_Fill);
    UG_DriverEnable(DRIVER_FILL_FRAME);

    UG_FillScreen(C_GREEN);
    vTaskDelay(500 / portTICK_RATE_MS);

    UG_DriverDisable(DRIVER_FILL_FRAME);

    UG_FillScreen(C_YELLOW);
    vTaskDelay(500 / portTICK_RATE_MS);

    UG_DrawLine(0,0,50,50,C_BLUE);
    UG_DriverDisable(DRIVER_DRAW_LINE);
    UG_DrawLine(0,5,50,55,C_BLACK);

    // UG_WindowCreate(&mWINDOW, &mGUI, MAX_OBJECTS, )
    // UG_WindowSetTitleText(&mWINDOW, "ZHAIXIANGYANG");
    // UG_WindowSetTitleTextFont(&mWINDOW, &FONT_22X36);
    // UG_WindowResize(&mWINDOW, 0, 0, 128, 160);
    // UG_WindowSetBackColor(&mWINDOW, C_BLUE);
    // while (1)
    // {
        
    // }
}
